﻿
 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>jb-aptech毕业设计项目</TITLE>
<meta name="renderer" content="ie-comp">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="../../css/style.css" rel="stylesheet" type="text/css">
		<script src="../../script/common.js"></script>
		<script src="../../script/validate.js"></script>
        <link rel="stylesheet" href="/css/bootstrap.min.css" type="text/css"></link>
        <script type="text/javascript" src="/js/jquery.min.js"></script>
        <script type="text/javascript" src="/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="/js/vue.js"></script>
	</head>
  	<script type="text/javascript">
  		
  		function myAdd(){
  			document.sysRoleForm.submit();
  		}
  	</script>
  <body>
   		<div class="page_title">
			权限管理 > 用户管理 > 系统角色管理 > 编辑角色
		</div>
        <div id="edit">
		<form name="sysRoleForm" method="post" action="/CRM/sysRole.do">
			<input type="hidden" name="method" value="editRole">
			<div class="button_bar">
	   		<button class="common_button" onclick="help('');">帮助</button>
	   		<button class="common_button" @click="back()" type="button">返回</button>
			<button class="common_button" @click="myAdd()" type="button">保存</button>
	   	</div>
	   	<table class="query_form_table">
	   		<tr>
	   			<th>编号</th>
	   			<td>
	   				<input type="text" v-model="sysRole.role_id" size="20" readonly="readonly">
	   			</td>
	   			<th>角色名</th>
	   			<td>
	   				<input type="text" v-model="sysRole.role_name" size="20">
	   			</td>
	   		</tr>
	   		<tr>
	   			<th>角色描述</th>
	   			<td>
	   				<textarea v-model="sysRole.role_desc" cols="20" rows="3">{{sysRole.role_desc}}</textarea>
	   			</td>
	   			<th>状态</th>
	   			<td>
	   				<select v-model="sysRole.role_flag"><option value="1">正常</option>
	   					<option value="0">禁用</option></select>
	   			</td>
	   		</tr>
	   	</table>
	   	<script>
				build_validate("sysRole.roleName","角色名不能为空","Limit","1","50");
				build_validate("sysRole.roleDesc","角色描述不能为空","Limit","1","50");
		</script>
	</form>
        </div>
        <script>
            var roles=new Vue({
                el:"#edit",
                data:{
                    sysRole:{
                        role_id:'',
                        role_name:'',
                        role_desc:'',
                        role_flag:''
                    }
                },
                methods:{
                    myAdd(){
                        $.getJSON("/updateRole",this.sysRole,function(json){
                            if(json.code==200){
                                alert("保存成功！");
                            }else{
                                alert("保存失败！");
                            }
                        })
                    },
                    back(){
                        location="/html/~right/role/list.html";
                    }
                },
                created(){
                    var role=JSON.parse(sessionStorage.getItem("role"));
                    this.sysRole=role;
                }
            });
        </script>
  </body>
</html>

